<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
    <title>Bootstrap 5</title>
    <style>
        /* 超小屏幕 */
        
        @media(max-width:576px) {
            .myCss {
                font-size: 16px;
                color: orange
            }
        }
        /* 智能手机 */
        
        @media (min-width:576px) {
            .myCss {
                font-size: 24px;
                color: blue;
            }
        }
        /* 中屏平板 */
        
        @media(min-width:768px) {
            .myCss {
                font-size: 32px;
                color: green;
            }
        }
        /* 小型显示器 */
        
        @media(min-width:992px) {
            .myCss {
                font-size: 48px;
                color: red;
            }
        }
        /* 小型显示器 */
        
        @media(min-width:1598px) {
            .myCss {
                font-size: 64px;
                color: black;
            }
        }
    </style>
</head>

<body>
    <h2 class="myCss">你好吗?要不要吃辣椒.</h2>
    <p>窗口宽度:<span id="width"></span></p>
    <script>
        var widthOutput = document.querySelector('#width');

        function resize() {
            widthOutput.textContent = window.innerWidth;
        }
        window.onresize = resize;
        resize();
    </script>
</body>


</html>